﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;

namespace Ttifa.WebApi.Controllers
{
    public class BaseController : ApiController
    {
        /// <summary>
        /// 当前请求的token key
        /// </summary>
        /// <returns></returns>
        private static string CurrentTokenKey
        {
            get
            {
                var key = string.Empty;

                var keys = HttpContext.Current?.Request.Headers.GetValues("Authorization");
                if (keys != null && keys.Length > 0)
                    key = keys[0];

                if (string.IsNullOrEmpty(key))
                    key = HttpContext.Current?.Request["token"];

                return key;
            }
        }
    }
}
